<?php

$connexion=sql_connecter();

?>
<!--  start page-heading -->
<div id="page-heading">
<h1>Accueil du site</h1>
</div>
<!-- end page-heading -->

<table border="0" width="100%" cellpadding="0" cellspacing="0"
	id="content-table">
	<tr>
		<th rowspan="3" class="sized"><img
			src="images/shared/side_shadowleft.jpg" width="20" height="300"
			alt="" /></th>
		<th class="topleft"></th>
		<td id="tbl-border-top">&nbsp;</td>
		<th class="topright"></th>
		<th rowspan="3" class="sized"><img
			src="images/shared/side_shadowright.jpg" width="20" height="300"
			alt="" /></th>
	</tr>
	<tr>
		<td id="tbl-border-left"></td>
		<td><!--  start content-table-inner ...................................................................... START -->
		<div id="content-table-inner"><!--  start table-content  -->
		<div id="table-content">
		<h1>A la une</h1>
		<br />
		<br />

		<!--		
/****************************************************************************************/
/*                               Partie tags                           */
/****************************************************************************************/
--> <?php /*
printf("<div id=\"tags\">");
printf("<div  class=\"tags\"><strong>TAGS</strong></div><br /><br />");
$requete="SELECT rang_tag, libelle_tag FROM tags ORDER BY Rand() ";
$resultat=sql_executer($connexion, $requete);

while ($ligne=sql_lire_ligne_tableau($resultat))
{
	$rang_tag=$ligne['rang_tag'];
	$rangpx = intval($rang_tag);

	switch ($rangpx){
		case 1:
			$rangpx= 11;
			break;
		case 2:
			$rangpx= 20;
			break;
		case 3:
			$rangpx= 30;
			break;
		case 4:
			$rangpx= 40;
			break;
		default:
			$rangpx= 1;
			break;
	}
	printf("&nbsp;&nbsp;<span class=\"tags_rang\" style=\"font-size:".$rangpx."px\">".$ligne['libelle_tag']." </span>");
}

printf("<br /><br /></div><br /><br />");*/

?>
		<div id="slidorion">

		<div id="slider"><!-- 		
/****************************************************************************************/
/*                                       slider                                         */
/****************************************************************************************/	
-->

		<div id="slide1" class="slide">
		<div class="content">
		<h2>New Features</h2>
		<h3>There's been some pretty important changes to Slidorion. Here are
		some of these changes...</h3>
		<ul>
			<li>
			<h4>Allows embedded HTML</h4>
			</li>
			<li>
			<h4>New random effect (slide, over and all)</h4>
			</li>
			<li>
			<h4>Easier usability</h4>
			</li>
			<li>
			<h4>Improved performance</h4>
			</li>
			<li>
			<h4>Bug fixes; click disabled during transition</h4>
			</li>
		</ul>
		</div>
		</div>
		<div id="slide2" class="slide"><img src="images/news/new.png"
			width="588" height="400" /></div>
		<div id="slide3" class="slide">
		<div class="content">
		<h1>Background Image with HTML Text</h1>
		<br />
		<h3>You can give each individual slide a unique background image,
		allow for full customisation.</h3>
		<br />
		<br />
		<h3>For a cool background effect, check out this <a
			href="demos/slidorion-background-demo.html">demo</a></h3>
		</div>
		</div>
		</div>
		<!--		
/****************************************************************************************/
/*                                    Partie droite                                     */
/****************************************************************************************/
-->
		<div id="accordion">
		<?php 
		$req="SELECT * FROM news WHERE etat_news = 1 order by date_news DESC LIMIT 0, 10";
		$res=sql_executer($connexion, $req);
		while ($lig=sql_lire_ligne_tableau($res))
		{
			$titre_news=$lig['titre_news'];
			$contenu_news=$lig['contenu_news'];
			$date_news=$lig['date_news'];
			$id_news=$lig['id_news'];

			$max = 600; // Le nombre maximal de caractères à afficher en page d'accueil
			if (strlen($contenu_news)>$max) {
				$new_contenu = substr($contenu_news, 0, $max)."...<a href=\"\">(lire la suite)</a>";
			}
			else{
				$new_contenu = $contenu_news;
			}


			printf("<div class=\"link-header\">$titre_news</div>");
			printf("<div class=\"link-content\">");
			//printf("<p><strong>$titre_news</strong>");
			printf("<p>$date_news</p>");
			printf("<p>$new_contenu</p>");
			printf("</div>");
		}

		?> 
		<!-- // fin link content --></div>

		</div>
		</div>
		<!--  end table-content  --> <!--		
/****************************************************************************************/
/*                               Partie dernieres questions                             */
/****************************************************************************************/
--> <?php 
printf("<div id=\"home_quest\">");
printf("<div  class=\"quest_home\"><a href=\"\"><strong>DERNIERES QUESTIONS</strong></a></div>");
printf("<div id=\"last_questions\">");
printf("<ul>");
$requete="SELECT titre_question, date_question from questions where etat_question=1 ORDER BY date_question DESC LIMIT 0, 10 ";
$resultat=sql_executer($connexion, $requete);

while ($ligne=sql_lire_ligne_tableau($resultat))
{
	printf("<li><a href=\"\">".$ligne['titre_question']."</a></li>");
}
printf("</ul>");
printf("</div>");
printf("</div>");

/****************************************************************************************/
/*                                  Partie derniers tutos                               */
/****************************************************************************************/

printf("<div id=\"home_tuto\">");
printf("<div  class=\"tuto_home\"><a href=\"\"><strong>DERNIERS TUTORIELS</strong></a></div>");
printf("<div id=\"last_tutos\">");
printf("<ul>");
$requete="SELECT titre_tutoriel, date_tutoriel from tutoriels where etat_tutoriel=1 ORDER BY date_tutoriel DESC LIMIT 0, 10 ";
$resultat=sql_executer($connexion, $requete);

while ($ligne=sql_lire_ligne_tableau($resultat))
{
	printf("<li><a href=\"\">".$ligne['titre_tutoriel']."</a></li>");
}
printf("</ul>");
printf("</div>");
printf("</div>");
?>

		<div class="clear"></div>

		</div>
		<!--  end content-table-inner ............................................END  -->
		</td>
		<td id="tbl-border-right"></td>
	</tr>
	<tr>
		<th class="sized bottomleft"></th>
		<td id="tbl-border-bottom">&nbsp;</td>
		<th class="sized bottomright"></th>
	</tr>
</table>
<div class="clear">&nbsp;</div>
